<template>
    <div>
        <el-form :model="ruleForm" ref="ruleForm" label-width="120px">
        <div>
            <div class="container">
                <h3 style="margin-bottom: 20px">产品信息</h3>
                <el-row class="demo-ruleForm">
                    <el-col :span="12">
                        <el-form-item label="产品类型：">
                            {{ruleForm.materialType}}
                        </el-form-item>
                         <el-form-item label="规格码：">
                                {{ruleForm.specsCode}}
                            </el-form-item>
                        <el-form-item label="产品大类：" v-if='switchHeadTab=="生产系统"'>
                            {{ruleForm.inventoryType}}
                        </el-form-item>
                        <el-form-item label="产品批号：">
                            {{ruleForm.batch}}
                        </el-form-item>
						<el-form-item label="装量：">
						    {{ruleForm.materialBreed.pelletWeight}}g
						</el-form-item>

                       <el-form-item label="生产日期：">
                           {{ruleForm.time}}
                       </el-form-item>
                        <el-form-item label="投料品名：">
                            {{ruleForm.productName}}
                        </el-form-item>

						<el-form-item label="投料批号：">
						    {{ruleForm.productBatch}}
						</el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="品名：">
                            {{ruleForm.breedName}}
                        </el-form-item>
						<el-form-item label="存货代码：">
						    {{ruleForm.inventoryCode}}
						</el-form-item>
                        <el-form-item label="发药机编码：">
                            {{ruleForm.dispenserCode}}
                        </el-form-item>
						<el-form-item label="相当于饮片：">
						    {{ruleForm.ypQuantity}}{{ruleForm.ypUnits}}
						</el-form-item>
                        <el-form-item label="保质期：">
                            {{ruleForm.deadLine}}月
                        </el-form-item>
                        <el-form-item label="生产负责人：">
                            {{ruleForm.principalUser}}
                        </el-form-item>
						<el-form-item label="投入量：">
						    {{ruleForm.scUseNum}}{{ruleForm.scUseNumUnits}}
						</el-form-item>

                            <el-form-item label="质量标准：">
                                {{ruleForm.qualityStandard}}
                            </el-form-item>
                            <!-- <el-input v-model="ruleForm.qualityStandard"  disabled placeholder=""  style="width:220px"></el-input> -->
                            <!-- {{ruleForm.qualityStandard}} -->

                    </el-col>
                </el-row>
            </div>
            <div class="container" style="margin-top:20px">
                <h3 style="margin-bottom: 20px">实际产量调整明细</h3>
                <el-table
                    :data="tableData"
                    border
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                >
                    <el-table-column prop="time" sortable label="调整日期"></el-table-column>
                    <el-table-column prop="newNumber" sortable label="实际产量">
                        <template slot-scope="scope">
                            {{scope.row.newNumber}}{{scope.row.units}}
                        </template>
                    </el-table-column>
                    <el-table-column prop="relevantUser" sortable label="调整人"></el-table-column>
                </el-table>
                <el-pagination layout="prev, pager, next" :page-size="pagesize1" @current-change="handleCurrentChange1" :total="total1" :current-page.sync="currentPage1" style="margin-top:20px"></el-pagination>
            </div>
            <el-form-item class="footerFixed">
                <el-button @click="backPage">返回</el-button>
            </el-form-item>
        </div>
        </el-form>
    </div>
</template>
<script>
import {pack_findById} from "@/request/api";
import { mapState } from 'vuex';
export default {
    data() {
        return {
            materialType: '',
            userList: [],
            tableData: [],
            productName: '',
            productBatch: '',
            ruleForm: {
                materialType: '配方颗粒',
                breedName: '',
                time: '',
                principalUser: '',
                principalUserId: '',
                inventoryCode: '',
                batch: '',
                totalNumber: '',
                units: '',
                warehouseId: '',
                warehouse: '',
                dispenserCode: '',
                manufactureId: '',
                inBatch: '',
                scUseNum: '',
                surplusNum: '',
                materialBreed:''


            },
            total1: 0,
            currentPage1:1,
            pagesize1:10,
        }
    },
    computed:{
        ...mapState(['switchHeadTab'])
    },
    mounted(){
        this.id = this.$route.query.id
        this.init();
        this.init1();
    },
    methods: {
        backPage () {
            this.$router.go(-1);
            this.$store.commit('setStorName',this.ruleForm.materialType)
        },
        init() {
            // pack_findById(this.id).then((res) =>{
            //     this.ruleForm = res.data
            // })
            pack_findById(this.id).then((res) =>{
                this.ruleForm = Object.assign({},res.data);
                this.ruleForm.productName = res.data.manufacture.breedName
                this.ruleForm.productBatch = res.data.manufacture.batch
                this.tableData = res.data.adjustLogList
            })
        },
        init1() {

        },
        handleSearch1() {
            this.init1()
        },
        handleCurrentChange1(val){
            this.currentPage1 = val
            this.init1()
        },
    },
}
</script>
<style scoped lang="less">
.el-date-editor.el-input{
    width: 200px !important
}
.el-pagination{
    text-align: center;
}
.el-select{
    width: 200px !important
}
.demo-ruleForm{
    margin-top: 20px;
}
</style>
